/* { dg-do run { target bitint } } */
/* { dg-options "-std=c23 -pedantic-errors" } */
/* { dg-skip-if "" { ! run_expensive_tests }  { "*" } { "-O0" "-O2" } } */
/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */

#if __BITINT_MAXWIDTH__ >= 156
struct S156 { unsigned _BitInt(156) a : 135; _BitInt(156) b : 2; };
struct S156 s1 = { 18071796389618321960417503813958783219759uwb, 0 };
struct S156 s2 = { 18071796389618321960417503813958783219759uwb, -1 };
struct T156 { _BitInt(156) a : 2; unsigned _BitInt(156) b : 135; _BitInt(156) c : 2; };
struct T156 s3 = { -1, 10623570996611319062233232245276988766900uwb, -1 };
struct T156 s4 = { 0, 10623570996611319062233232245276988766900uwb, 0 };
#endif
#if __BITINT_MAXWIDTH__ >= 230
struct U230 { _BitInt(230) a : 140, b : 140, c : 168; unsigned _BitInt(230) d : 135; _BitInt(230) e : 2; };
struct U230 s5 = { -1, -1, -167793869854583920719725244652254633450201662238868wb, -1, -1 };
struct U230 s6 = { 0, 0, -167793869854583920719725244652254633450201662238868wb, 0, 0 };
#endif
#if __BITINT_MAXWIDTH__ >= 412
struct S412 { unsigned _BitInt(412) a : 391; _BitInt(412) b : 2; };
struct S412 s7 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, 0 };
struct S412 s8 = { 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb, -1 };
struct T412 { _BitInt(412) a : 2; unsigned _BitInt(412) b : 391; _BitInt(412) c : 2; };
struct T412 s9 = { -1, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, -1 };
struct T412 s10 = { 0, 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb, 0 };
#endif
#if __BITINT_MAXWIDTH__ >= 486
struct U486 { _BitInt(486) a : 396, b : 396, c : 424; unsigned _BitInt(486) d : 391; _BitInt(486) e : 2; };
struct U486 s11 = { -1, -1, -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, -1, -1 };
struct U486 s12 = { 0, 0, 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb, 0, 0 };
#endif

#if __BITINT_MAXWIDTH__ >= 156
__attribute__((noipa)) _BitInt(156)
f1 (struct S156 *p)
{
  return p->a;
}

__attribute__((noipa)) _BitInt(156)
f2 (struct T156 *q)
{
  return q->b;
}
#endif

#if __BITINT_MAXWIDTH__ >= 230
__attribute__((noipa)) _BitInt(230)
f3 (struct U230 *q)
{
  return q->c;
}
#endif

#if __BITINT_MAXWIDTH__ >= 412
__attribute__((noipa)) _BitInt(412)
f4 (struct S412 *p)
{
  return p->a;
}
#endif

#if __BITINT_MAXWIDTH__ >= 486
__attribute__((noipa)) _BitInt(412)
f5 (struct T412 *q)
{
  return q->b;
}

__attribute__((noipa)) _BitInt(486)
f6 (struct U486 *q)
{
  return q->c;
}
#endif

int
main ()
{
#if __BITINT_MAXWIDTH__ >= 156
  if (f1 (&s1) != 18071796389618321960417503813958783219759wb
      || f1 (&s2) != 18071796389618321960417503813958783219759wb
      || f2 (&s3) != 10623570996611319062233232245276988766900wb
      || f2 (&s4) != 10623570996611319062233232245276988766900wb
#if __BITINT_MAXWIDTH__ >= 230
      || f3 (&s5) != -167793869854583920719725244652254633450201662238868wb
      || f3 (&s6) != -167793869854583920719725244652254633450201662238868wb
#if __BITINT_MAXWIDTH__ >= 412
      || f4 (&s7) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb
      || f4 (&s8) != 3345867579074605921998363891622879168820794533140203757607077179689806177940265164723139484043689737118576518770430659uwb
      || f5 (&s9) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb
      || f5 (&s10) != 4349534826165161048611343533362431993802129027379695873644854753645283352804798649538744513979417539155427766538864041uwb
#if __BITINT_MAXWIDTH__ >= 486
      || f6 (&s11) != -13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb
      || f6 (&s12) != 13261086392773587186244717277670203234755842300010780483040284280064790949739084884446379147987979627678541509279207301027482398wb
#endif
#endif
#endif
      || 0)
    __builtin_abort ();
#endif
}
